{include file="public/meta" /}

<title>添加经销商</title>
</head>

<body>
    <article class="cl pd-20">
        <form action="" method="post" class="form form-horizontal" id="form-member-add">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户名：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="username" name="username">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>昵称：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="nickname" name="nickname">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="mobile" name="mobile">
                </div>
            </div>
            <!-- <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>邮箱：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="email" name="email">
                </div>
            </div> -->
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>密码：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" name="password" id="password" value="123456">
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary radius" type="button" onclick="adminadd()" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                </div>
            </div>
        </form>
    </article>

    <!--_footer 作为公共模版分离出去-->
    {include file="public/footer" /}
    <!--/_footer /作为公共模版分离出去-->

    <!--请在下方写此页面业务相关的脚本-->
    <script type="text/javascript" src="__LIB__/My97DatePicker/4.8/WdatePicker.js"></script>
    <script type="text/javascript" src="__LIB__/jquery.validation/1.14.0/jquery.validate.js"></script>
    <script type="text/javascript" src="__LIB__/jquery.validation/1.14.0/validate-methods.js"></script>
    <script type="text/javascript" src="__LIB__/jquery.validation/1.14.0/messages_zh.js"></script>
    <script type="text/javascript">
        function adminadd() {
            var username = $("#username").val(),
                nickname = $("#nickname").val(),
                mobile = $("#mobile").val(),
                // email = $("#email").val(),
                password = $("#password").val();
            if (!username) {
                layer.msg('请输入用户名', {
                    icon: 5,
                    time: 1000
                });
                return false;
            }
            if (!nickname) {
                layer.msg('请输入昵称', {
                    icon: 5,
                    time: 1000
                });
                return false;
            }
            if (!mobile) {
                layer.msg('请输入手机号', {
                    icon: 5,
                    time: 1000
                });
                return false;
            }
            if (!password) {
                layer.msg('请输入密码', {
                    icon: 5,
                    time: 1000
                });
                return false;
            }
            $.ajax({
                type: 'post', // 提交方式 get/post
                url: "{:url('adminadd')}", // 需要提交的 url
                dataType: "json",
                data: {
                    'username': username,
                    'nickname': nickname,
                    'mobile': mobile,
                    // 'email': email,
                    'password': password
                },
                success: function(data) {
                    if (data.code == 0) {
                        parent.layer.msg(data.msg, {
                            icon: 6,
                            time: 1000
                        });
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.window.location.reload();
                        parent.layer.close(index);
                    } else {
                        layer.msg(data.msg, {
                            icon: 5,
                            time: 1000
                        });
                    }
                }
            });

        }
    </script>
    <!--/请在上方写此页面业务相关的脚本-->
</body>

</html>